﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Hkwl.WorldExpo.Merchant.Common;
using Hkwl.WorldExpo.Merchant.Model;
using Hkwl.WorldExpo.Merchant.Service;

namespace Hkwl.WorldExpo.Merchant.Web
{
    public partial class ClientView : BaseCheckPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            { 
                int clientId = int.Parse(Request.QueryString["ClientId"]);
                NxClient nxClient = ServiceLocator.IClientService.GetNxClientById(clientId);
                this.lbCellPhone.Text = nxClient.Cellphone;
                this.lbCompany.Text = nxClient.Company;
                this.lbUserName.Text = nxClient.UserName;
                this.lbSex.Text = nxClient.Sex == 1 ? (String)GetGlobalResourceObject("Default", "MALE") : (String)GetGlobalResourceObject("Default", "FEMALE");
                this.lbAge.Text = nxClient.Age.ToString();
            }
        }

        protected void btnBack_Click(object sender, EventArgs e)
        {
            JavaScript.WriteJs("history.go(-2);", this.Page);
        }

        protected void btnModify_Click(object sender, EventArgs e)
        {
            Response.Redirect("ModifyClient.aspx?ClientId=" + Request.QueryString["ClientId"]);
        }
    }
}
